home *** CD-ROM | disk | FTP | other *** search
/ Info-Mac 4 / Info_Mac IV CD-ROM (Pacific HiTech Inc.)(August 1994).iso / Development / Source / Library & Plugs / RossetMADF Library 68K & PPC / RDriver.h < prev    next >
Encoding:
C/C++ Source or Header  |  1994-04-11  |  5.1 KB  |  180 lines  |  [TEXT/KAHL]

  1. #include "stdio.h"
  2. #include "string.h"
  3.  
  4. #define MAX_ARP 3
  5. #define NUMBER_FINETUNES 17
  6. #define AMIGA_CLOCKFREQ 33659820        //35758720
  7. #define MIN_PITCH 142
  8. #define MAX_PITCH 17161L
  9. #define MIN_VOLUME 0
  10. #define MAX_VOLUME 64
  11. #define ACCURACY 12
  12. #define fix_to_int(x) ((x) >> ACCURACY)
  13. #define int_to_fix(x) ((x) << ACCURACY)
  14. #define    FREQBASE        152L    // -> Utilisé avec le pitch qui est divisé par 10 !!!!!
  15. #define MAXTRACK        32
  16. #define MAXINSTRU        64
  17. #define MAXPATTERN        200
  18.  
  19. struct VoiceActive    {
  20.         Ptr            MaxPtr;
  21.         Ptr            InstruVoice;
  22.         Ptr            StartPtr;
  23.         long        loopWord;
  24.         long        loopWords;
  25.         short            whichInstru;
  26.         short            whichInstruOld;
  27.         short            lastpitch;
  28.         short            pitch;              /* current pitch of the sample */
  29.         short         realpitch;
  30.         short            volume;
  31.         short            arg;
  32.         short         note;               /* we have to save the note cause */
  33.                                         /* we can do an arpeggio without a new note */
  34.     
  35.         short         arp[MAX_ARP];       /* the three pitch values for an arpeggio */
  36.         short         arpindex;           /* an index to know which note the arpeggio is doing    */
  37.  
  38.         short            viboffset;          /* current offset for vibrato (if any) */
  39.         short         vibdepth;           /* depth of vibrato (if any) */
  40.  
  41.         short         slide;              /* step size of pitch slide */
  42.  
  43.         short         pitchgoal;          /* pitch to slide to */
  44.         short         pitchrate;          /* step rate for portamento */
  45.         short            oldpitchrate;
  46.  
  47.         short         volumerate;         /* step rate for volume slide */
  48.  
  49.         short         vibrate;            /* step rate for vibrato */
  50.         short            oldvibrate;
  51.  
  52.         short         retrig;             /* delay for extended retrig command */
  53.         short         effect;
  54.         short            ID;
  55. };
  56. typedef        struct VoiceActive    VoiceActive;
  57.  
  58. struct    MODPartition    {
  59.         SoundTrackSpec*            header;
  60.         struct    MusicPattern*    partition[ MAXPATTERN];
  61.         Ptr                        instrument[ MAXINSTRU];
  62. };
  63. typedef        struct MODPartition    MODPartition;
  64.  
  65. #ifdef MAINSYSTEM
  66. #define EXT
  67. #else
  68. #define EXT extern
  69. #endif
  70.  
  71. EXT    MODPartition            thePartition;
  72. EXT    VoiceActive                theVoiceActive[ MAXTRACK];
  73. EXT    short                        DriverTypeInt, smallcounter;
  74. EXT    unsigned char            InstruEffect;
  75. EXT    short                        Tube[ MAXTRACK], PartitionReader, Pat, PL, VolExt[ MAXTRACK];
  76. EXT    long                    DBTick, ASCBUFFER;
  77. EXT    short                        TotInstru, speed, finespeed, **FreqHandle, InstruActif[ MAXINSTRU], InstruTube[ MAXINSTRU];
  78. EXT    Ptr                        SysHeapPtr, Vol, IntPtr[ 2], PseudoBuf[ 2];
  79. EXT    Boolean                    MODFileType, InternalRestart, Reading, MusiqueFertig, SMTicker;
  80. EXT    SoundTrackSpec            *theFileInt;
  81. EXT    long                    oldNotePosAA, SInc, VMOD, VExt, FreqExt;
  82.  
  83. EXT    Boolean                    DriveStereo, PtrSystem;
  84. EXT    short                        DriveOutBit, DriveTrackNo;
  85.  
  86. extern    short    Tuning[ ], vibrato_table[ ];
  87.  
  88.  
  89. enum {
  90.     ASCMono = 1,
  91.     ASCStereo = 2,
  92.     SMMono = 3,
  93.     SMStereo = 4,
  94.     SMDSP = 5,
  95.     SMPolyPhonic = 6
  96. };
  97.  
  98. enum {
  99.         set_arpeggio = 0,
  100.         set_speed = 15,
  101.         set_skip = 13,
  102.         set_fastskip = 11,
  103.         set_volume = 12,
  104.         set_slidevol = 10,
  105.         set_offset = 9,
  106.         set_portamento = 3,
  107.         set_portaslide = 5,
  108.         set_upslide = 2,
  109.         set_downslide = 1,
  110.         set_vibrato = 4,
  111.         set_vibratoslide = 6,
  112.         set_extended = 14,
  113.         set_nothing = 7,
  114.         do_retrig = 50,
  115.         do_cut = 51
  116.     };
  117.  
  118. void    Sampler8in8( VoiceActive *curVoice, register Ptr ASCBuffer);
  119. void    Sampler8in8Add( VoiceActive *curVoice, register Ptr    ASCBuffer);
  120. void    Sampler16( VoiceActive *curVoice, register short    *ASCBuffer);
  121. void    Sampler16Add( VoiceActive *curVoice, register short    *ASCBuffer);
  122. void    NoteAnalyse( void);
  123. OSErr    RInitMOD( short, short);
  124. void    ChangeTrackNo( short);
  125. OSErr    RLoadMOD( Str255 fName);
  126. OSErr    RPlayMOD(void);
  127. OSErr    RStopMOD(void);
  128. OSErr    RQuitMOD(void);
  129. OSErr    RResetMOD(void);
  130. OSErr    RClearMOD(void);
  131. void    CleanDriver();
  132. OSErr    SetUpFrequence( long, long);
  133. OSErr    RLoadMADFRsrc( OSType IDName, short    IDNo);
  134. OSErr    ReadInstrument( short, long, Boolean, Handle);
  135. OSErr    AmigatoSnd22(Handle sound, long SizeH);
  136. OSErr    SetMODVol(void);
  137. OSErr     SetMODVol2(void);
  138. void    DoEffect( VoiceActive *);
  139. OSErr    DBSndClose();
  140. void    StopChannel();
  141. OSErr     SetMODVol4( long , long , Boolean );
  142. void    PlayChannel();
  143. void     checkpitch( VoiceActive *, Boolean);
  144. void     BufferCopyM();
  145. OSErr    RInstallMADF( MODPartition aPartition);
  146. void     BufferCopyS();
  147. void    ConvertMod2Mad( Ptr        aMOD, long MODSize, MODPartition        *theMAD);
  148. Ptr        ConvertMad2Mod( MODPartition *theMAD, long MODSize);
  149. void     TestBufferCopyS();
  150. void    RemplaceMODFile( Ptr theNewPtr);
  151. void    MODPlay(void);
  152. void    InstallMODVBL(void);
  153. struct Command* GetCommand( register short PosX, register short    TrackIdX, register    struct MusicPattern*    tempMusicPat);
  154. void     ReadNote( VoiceActive *curVoice, struct Command        *theCommand);
  155. void    RemoveMODVBL(void);
  156. void    MODRelance(void);
  157. void    AmigatoSnd(Handle sound, long SizeH);
  158. void    Play(void);
  159. void    BufferCopyLeft(void);
  160. void    BufferCopyRight(void);
  161. void    VIAOn(void);
  162. void     SndOff(void);
  163. void     SndOn(void);
  164. void     BufferTestM(void);
  165. void    VIAOn2(void);
  166. void     VIAOn3(void);
  167. OSErr    InitDBSoundManager( long);
  168. void    SetUpEffect( short Arg, VoiceActive *ch);
  169. void    DoEffect( VoiceActive *ch);
  170. Boolean DirectSave( Ptr, Boolean);
  171. void    ChangeSpeed( void);
  172. void    Play16Stereo( void);
  173. void    Play8Stereo( void);
  174. void    Play8Mono( void);
  175. long    decode32 (void *msg_buf);
  176. short    decode16 (void *msg_buf);
  177. long    Tdecode32 (void *msg_buf);
  178. short    Tdecode16 (void *msg_buf);
  179. void ClearFrequence();
  180.